package com.bestom.smartwatch.util;

/**
 *  进制转换工具
 * */
public class ConversionUtil {

    private static ConversionUtil instance;

    public static ConversionUtil getInstance() {
        if (instance == null) {
            instance = new ConversionUtil();
        }
        return instance;
    }

    public String printHexString( byte[] b) {
        if(b == null) {
            return "";
        }

        StringBuilder hexString = new StringBuilder();
        for (byte value : b) {
            String hex = Integer.toHexString(value & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }
            hexString.append(hex.toUpperCase()).append(" ");
        }
        return hexString.toString();
    }
}
